﻿@model sBlog.Net.Models.PostModel
<div class="postHome" style="width: 305px;">
    @{
        var url = Url.RouteUrl("IndividualPost", new { year = Model.Post.PostYear, month = Model.Post.PostMonth, url = Model.Post.PostUrl, status = string.Empty });
        string folder = Model.Post.Folder;
            //var folder = "";
            //if (int.Parse(Model.Post.PostYear + Model.Post.PostMonth) <= 201405)
            //{
            //    folder = "201405";
            //}
            //else
            //{
            //    folder = Model.Post.PostYear + Model.Post.PostMonth;
            //}
    }
    <p>
        <a href="@url">
            <img src="@Url.Content("http://s1.img.yan.vn/Mlog/UploadThumbs/" + folder + "/" + Model.Post.PostAvatar)" style="border: none 0;" width="305" alt="avatar"/></a>
    </p>
    <div class="boxAuthorViewLike">
        <div class="posted" style="float: left;">
            @foreach (var category in Model.Post.Categories)
            {
                switch (category.CategorySlug.ToLower())
                {
                    case "hinh-anh":
                @:<a href="/chuyen-muc/hinh-anh"><img src="@Url.Content("~/Content/Images/MlogThem/hinhanh-icon.png")"width="37"height="37"alt="hìnhảnh"/></a>
                            break;
                    case "video":
                @:<a href="/chuyen-muc/video"><img src="@Url.Content("~/Content/Images/MlogThem/video-icon.png")"width="37"height="37"alt="Tags"/></a>
                            break;
                    case "bai-viet":
                @:<a href="/chuyen-muc/bai-viet"><img src="@Url.Content("~/Content/Images/MlogThem/baiviet-icon.png")"width="37"height="37"alt="bàiviết"/></a>
                            break;
                    default:
                @:<a href="/chuyen-muc/bai-viet"><img src="@Url.Content("~/Content/Images/MlogThem/baiviet-icon.png")"width="37"height="37"alt="bàiviết"/></a>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            break;
                }
            }
            @if (Model.Post.UserAvatar == null || Model.Post.UserAvatar == string.Empty || Model.Post.UserAvatar == "")
            {
                @:&nbsp;<img src="@Url.Content("~/Content/Images/MlogThem/NoAvata.png")" style="border:none0;margin-bottom:8px;position:relative;"width="30"height="30"alt="useravatar"/>
            }
            else
            {
                @:&nbsp;<img src="@Url.Content("http://s1.img.yan.vn/Mlog/UploadUserAvatar/30x30_" + Model.Post.UserAvatar)"style="border:none0;margin-bottom:8px;position:relative;"width="30"height="30"alt="useravatar"/>
                                                                                    }
            &nbsp;<span class="authorInPost">@Html.ActionLink(Model.Post.OwnerUserName, "PostsByAuthor", "Author", new { authorName = Model.Post.UserName }, new { })</span>
        </div>
    </div>
    <div class="clear">
    </div>
    <h2 class="postHometitle">
        <a href="@url">@Html.Raw(Model.Post.PostTitle)</a>
    </h2>
    <hr style="width: 40%; margin: 5px auto;" />
    <span class="date">@DateTime.Parse(Model.Post.PublicDate.ToString()).ToString("dd/MM/yyyy HH:mm tt")</span>
    <div class="clear">
    </div>
    <div class="entry">
        <div class="description">
            @{
                var shortDescription = Model.Post.PostDescription.Length > 200 ? string.Format("{0}...", Model.Post.PostDescription.Substring(0, 165)) : Model.Post.PostDescription;
            }
            @Html.Raw(@shortDescription)
        </div>
        <div class="clear" style="height: 10px;">
            &nbsp;
        </div>
        <div class="lineDotted">
        </div>
        <div class="clear" style="height: 10px;">
            &nbsp;
        </div>
        <div style="float: left;">
            <img src="@Url.Content("~/Content/Images/MlogThem/tag.png")" width="15" height="15" alt="Tags"/>
        </div>
        <span class="tags">@Html.Partial("PostTags", Model.Post.Tags) </span>
        <div class="clear">
        </div>
        <div class="boxViewLike">
            <img src="@Url.Content("~/Content/Images/MlogThem/IconView.png")" width="17" height="12" alt="View count"/>&nbsp;@Convert.ToInt32(@Model.Post.ViewCount).ToString("#,##0")&nbsp;
            <img src="@Url.Content("~/Content/Images/MlogThem/heart-follow.png")" width="12" height="12" alt="like count"/>&nbsp;@Convert.ToInt32(@Model.Post.LikeCount).ToString("#,##0")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
    </div>
</div>
